<?php
class Marticle extends CI_Model{
	protected $_table="tpt_article";
    protected $_table_1="tpt_article_content";
	protected $_table_2="tpt_catalogue";
	protected $_table_3="tpt_section";
    protected $_table_4="tpt_tag";
	public function __construct(){
		parent::__construct();	
		$this->load->database();
	}

	public function showArticleById($id){
		$this->db->select('a.id, b.title, b.url, a.thumb, b.content, a.created_at, a.image, a.keywords, a.description');
        $this->db->from($this->_table.' as a');
		$this->db->join($this->_table_1.' as b','a.id = b.art_id','left');
        $this->db->join($this->_table_2.' as c','a.cata_id = c.id','left');
        $this->db->join($this->_table_3.' as d','a.sec_id = d.id','left');
		$this->db->where('a.check',0);
		$this->db->where('a.id',$this->db->escape_str($id));
		// $this->db->where('b.lang_id',2);
        return $this->db->get()->row_array();
	}
}